package com.demo.controller;

import com.demo.service.DeptService;
import com.dove.pojo.Dept;
import com.netflix.ribbon.proxy.annotation.Hystrix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    DeptService deptService;

    @PostMapping("/add")
    public boolean add(Dept dept){
        return deptService.addDept(dept);
    }
    @GetMapping("/get/{id}")
    public Dept get(@PathVariable Long id){
        return deptService.queryById(id);
    }
    @GetMapping("/list")
    public List<Dept> queryAll(){
        return deptService.queryAll();
    }

}
